package com.liang.text;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.util.Scanner;

public class SendMes extends Thread {
    public static boolean flag = false;

    private Socket socket;

    public SendMes(Socket socket) {
        this.socket = socket;
    }

    //    public void SendMes(Socket socket) {
//        this.socket = socket;
//    }
    @Override
    public void run() {
        Scanner sc = new Scanner(System.in);
        while (true) {
            String s = sc.nextLine();
            try {
                OutputStream os= socket.getOutputStream();
                BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
                if (s.equals("886")) {
                    flag=true;
                }else{
                    bw.write(s);
                    bw.newLine();
                    bw.flush();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
